package com.travel.service.impl;

/**
 * 酒店评论业务
 * @author zourenhe
 *
 */

import java.util.List;

import com.travel.dao.HotelCommentDao;
import com.travel.dao.impl.HotelCommentDaoImpl;
import com.travel.entity.Comment;
import com.travel.service.HotelCommentService;
import com.travel.util.PageInfo;

public class HotelCommentServiceImpl implements HotelCommentService {

	private HotelCommentDao commentDao = new HotelCommentDaoImpl();

	@Override
	public List<Comment> getCommentList() {
		// TODO Auto-generated method stub
		return commentDao.find();
	}

	@Override
	public boolean deleteById(int commentId) {
		int i = commentDao.deleteById(commentId);

		return i > 0 ? true : false;
	}

	@Override
	public boolean insert(Comment comment) {
		int i = commentDao.insert(comment);
		return i == 1 ? true : false;

	}

	@Override
	public PageInfo<Comment> getUserListByPage(int pageNum, int pageSize) {
		// TODO Auto-generated method stub
		if (pageNum <= 0) {
			pageNum = 1;
		}
		if (pageSize <= 0) {
			pageSize = 2;
		}
		return commentDao.findByPage(pageNum, pageSize);

	}

}
